package com.apes.enquiry.enquiry.repository;

import com.apes.enquiry.enquiry.model.QuoteItem;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 类描述：
 *
 * @ClassName QuoteItemRepsoitory
 * @Description 描述
 * @Author wushilong
 * @Date 2023/3/20 16:42
 * @Version 1.0
 */
public interface QuoteItemRepository extends CustomRepository<QuoteItem, String> {

    @Query(value = "select a.enquiryItemId from QuoteItem a where a.quoteId = :quoteId")
    List<String> findAllQuoteId(String quoteId);

    @Query(value = "select a.* from sp_mas_quote_item a where a.quote_id = :quoteId",nativeQuery = true)
    List<QuoteItem> findAllQuote(String quoteId);

    @Query(value = "select a from QuoteItem a where a.partyRoleId = :supplier and a.enquiryItemId = :enquiryItemId and a.quoteId = :quoteId")
    List<QuoteItem> findQuoteIdAndSupplierAndCategory(String supplier, String enquiryItemId, String quoteId);

    @Query(value = "select a from QuoteItem a where a.partyRoleId = :supplier and a.quoteId = :quoteId")
    List<QuoteItem> findQuoteIdAndSupplier(String supplier, String quoteId);
}
